﻿@model BrnMall.Web.StoreAdmin.Models.StoreAppTabBarSettingModel

@section header{
    <title>设置底部导航-首页定制</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
    <link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
    <link type="text/css" rel="stylesheet" href="/components/spectrum/spectrum.css" />
    <script type="text/javascript" src="/components/spectrum/spectrum.js?v=1"></script>
    <script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <style>
        .preview-wrap {
            position: fixed;
            width: 100%;
            text-align: left;
            overflow-y: auto;
            height: 100%;
            overflow-x: hidden;
        }

        #phone-component {
            position: relative;
            display: inline-block;
            width: 332px;
            height: 678px;
            margin-left: 30px;
            margin-right: 30px;
            background-image: url(http://static.711688.net.cn/weapp/images/6s.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
            vertical-align: top;
            z-index: 999;
        }

        .phone-head {
            position: absolute;
            top: 81px;
            left: 22px;
            width: 288px;
            height: 58px;
            background-image: url(http://static.711688.net.cn/weapp/images/phone-head.jpg);
            background-size: 100% 100%;
            background-repeat: no-repeat;
        }

        .phone-content {
            position: absolute;
            top: 139px;
            left: 22px;
            width: 288px;
            height: 454px;
            overflow: hidden;
            background-color: #fff;
        }

        .preview-iframe {
            display: block;
            position: relative;
            width: 320px;
            height: 504px;
            transform: scale(0.9);
            -webkit-transform: scale(0.9);
            -ms-transform: scale(0.9);
            -moz-transform: scale(0.9);
            transform-origin: 0 0;
            -webkit-transform-origin: 0 0;
            -ms-transform-origin: 0 0;
            -moz-transform-origin: 0 0;
            outline: none;
            border: none;
        }

        .phone-head span {
            color: #fff;
            cursor: pointer;
            position: absolute;
            left: 10px;
            top: 25px;
            font-size: 14px;
            line-height: 25px;
            padding-left: 14px;
            background-image: url(http://static.711688.net.cn/weapp/images/left.png);
            background-size: auto 15px;
            background-repeat: no-repeat;
            background-position: left center;
        }
        /*--phone-6plus--*/
        #phone-component.phone-6plus {
            width: 332px;
            height: 670px;
            background-image: url(http://cdn.jisuapp.cn/zhichi_frontend/static/webapp/images/phone/6s.png);
        }

            #phone-component.phone-6plus .phone-head {
                top: 81px;
                left: 22px;
                width: 288px;
            }

            #phone-component.phone-6plus .phone-content {
                top: 139px;
                left: 22px;
                width: 288px;
                height: 446px;
            }

            #phone-component.phone-6plus .preview-iframe {
                width: 320px;
                height: 495px;
                transform: scale(0.9);
                -webkit-transform: scale(0.9);
                -ms-transform: scale(0.9);
                -moz-transform: scale(0.9);
            }
        /*---phone 5s---*/
        #phone-component.phone-5s {
            width: 312px;
            height: 648px;
            background-image: url(http://static.711688.net.cn/weapp/images/5s.png);
        }

            #phone-component.phone-5s .phone-head {
                top: 93px;
                left: 25px;
                width: 262px;
            }

            #phone-component.phone-5s .phone-content {
                top: 150px;
                left: 26px;
                width: 260px;
                height: 405px;
            }

            #phone-component.phone-5s .preview-iframe {
                width: 320px;
                height: 498px;
                transform: scale(0.8125);
                -webkit-transform: scale(0.8125);
                -ms-transform: scale(0.8125);
                -moz-transform: scale(0.8125);
            }
        /*--二维码*/
        .service-component {
            /*display: inline-block;*/
            margin-left: 30px;
            text-align: center;
            width: 300px;
            height: 560px;
            /* padding: 30px; */
            margin-top: 60px;
            background: #fff;
            border: 1px solid #e6e6e6;
            border-radius: 3px;
            box-shadow: -1px -1px 5px #eee, 1px 1px 5px #eee;
            vertical-align: top;
        }

        .code-container {
            position: relative;
            display: inline-block;
            width: 200px;
            height: 218px;
            margin: 40px 0 10px;
            border: 1px solid #ccc;
        }

        #preview-code {
            width: 200px;
            height: 200px;
        }

        .service-component .code-container-text {
            position: absolute;
            color: #535353;
            font-size: 12px;
            bottom: 3px;
            width: 200px;
            line-height: 20px;
            height: 20px;
        }

        .box {
            width: 557px;
            position: relative;
            cursor: pointer;
        }

            .box .bmbox {
                width: 557px;
                height: 100%;
                background: black;
                position: absolute;
                bottom: 0px;
                left: 0px;
                display: none;
                font: 12px/30px "宋体";
                color: white;
                text-align: center;
            }

            .box:hover .bmbox {
                background-color: rgba(0,0,0,0.5);
                display: block;
                text-align: center;
                vertical-align: center;
            }

        .btn {
            font-size: 18px;
            line-height: 200%;
            border-radius: 5px;
            background-color: coral;
            color: white;
            padding: 5px;
            display: block;
            width: 200px;
            margin-left: 180px;
            text-decoration: none;
        }
        body .button:hover{color:#fff}
    </style>
}
@section body{
    <h1 class="rightH1">
        微信小程序 > 首页定制 > 小程序列表 > <span class="rightH1-cur">设置底部导航</span>
        <div class="right">
            <a href="@Url.Action("StoreAppList")" class="menuBT"><img src="/admin_store/images/goback.jpg" />返回列表</a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    <table width="100%">
        <tr>
            <td style="vertical-align: top;height: 678px">
                @using (Html.BeginForm("EditStoreAppTabBarSetting", "WeApp"))
    {
                    @Html.HiddenFor(x => x.StoreAppId)
                    @Html.HiddenFor(x => x.borderStyle)
                    @Html.HiddenFor(x => x.boxShadow)
                    <style>
                        .addTable table td {
                            height: 25px;
                        }
                    </style>

                    <div class="addTable">
                        <table width="100%">
                            <tr>
                                <td width="180px" align="right">文字颜色：</td>
                                <td width="80">@Html.TextBoxFor(x => x.color, new { @type = "color" })</td>
                                <td rowspan="3">
                                    <div class="dataList">
                                        <table>
                                            <thead>
                                                <tr>

                                                    <th align="center">导航文字</th>
                                                    <th align="center">链接地址</th>
                                                    <th align="center">图标</th>
                                                    <th align="center">操作</th>
                                                    <th align="center">操作</th>
                                                </tr>
                                            </thead>
                                            @for (int i = 0; i < Model.list.Count; i++)
                                            {

                                                <tr>


                                                    <td width="80" align="center">

                                                        @Html.TextBoxFor(x => x.list[i].text, new { @class = "input", size = "5", maxlength = "3", required = true })

                                                        @Html.HiddenFor(x => x.list[i].iconPath)
                                                        @Html.HiddenFor(x => x.list[i].selectedIconPath)
                                                    </td>
                                                    <td width="80" align="center">
                                                        @if (i == 0)
                                                        {
                                                            @Html.HiddenFor(x => x.list[i].pagePath)
                                                            @:首页
                                            }
                                                        else
                                                        {
                                                            @Html.DropDownListFor(x => x.list[i].pagePath, Model.AppPages.Select(t => new SelectListItem
                                                       {
                                                           Text = t.Name,
                                                           Value = t.Url,
                                                           Selected = Model.list[i].pagePath == t.Url
                                                       }))
                                                            //new SelectListItem {Text = "餐位", Value = "pages/predetermine/index", Selected = Model.list[i].pagePath == "pages/predetermine/index"}

                                                        }


                                                    </td>
                                                    <td width="80" align="center">

                                                        @if (Model.list[i].selectedIconPath.StartsWith("images"))
                                                        {
                                                            <img id="@("tabicon"+i)" rawIconPath="@WorkContext.ImageCDN/@Model.list[i].selectedIconPath" selectedIconPath="@Model.list[i].selectedIconPath" iconPath="@Model.list[i].iconPath" src="@WorkContext.ImageCDN/@Model.list[i].selectedIconPath" width="50" height="50" />
                                                        }
                                                        else
                                                        {
                                                            <img id="@("tabicon"+i)" rawIconPath="@WorkContext.ImageCDN/images/@Model.list[i].selectedIconPath" selectedIconPath="@Model.list[i].selectedIconPath" iconPath="@Model.list[i].iconPath" src="@WorkContext.ImageCDN/images/@Model.list[i].selectedIconPath" width="50" height="50" />
                                                        }



                                                    </td>
                                                    <td width="80" align="center">

                                                        <select name="@("tabiconmenu"+i)" data-index="@i" class="tabicon" id="@("tabiconmenu"+i)">
                                                            <option value="" data-imgsrc="" selected="selected">更改图标</option>
                                                            <option value="tabicon/shouye-on-1.png">首页1</option>
                                                            <option value="tabicon/shouye-on-2.png">首页2</option>
                                                            <option value="tabicon/fenlei-on-1.png">分类1</option>
                                                            <option value="tabicon/fenlei-on-2.png">分类2</option>
                                                            <option value="tabicon/fenlei-on-3.png">分类3</option>
                                                            <option value="tabicon/fenlei-on-4.png">分类4</option>
                                                            <option value="tabicon/fenlei-on-5.png">分类5</option>
                                                            <option value="tabicon/fenxiao-on-1.png">分销</option>
                                                            <option value="tabicon/gouwuche-on-1.png">购物车1</option>
                                                            <option value="tabicon/gouwuche-on-2.png">购物车2</option>
                                                            <option value="tabicon/guahao-on-1.png">挂号</option>
                                                            <option value="tabicon/guanyu-on-1.png">关于1</option>
                                                            <option value="tabicon/guanyu-on-2.png">关于2</option>
                                                            <option value="tabicon/guanyu-on-3.png">关于3</option>
                                                            <option value="tabicon/kefu-on-1.png">客服1</option>
                                                            <option value="tabicon/kefu-on-2.png">客服2</option>
                                                            <option value="tabicon/miaosha-on-1.png">秒杀</option>
                                                            <option value="tabicon/pingtuan-on-1.png">拼团</option>
                                                            <option value="tabicon/wode-on-1.png">我的</option>
                                                            <option value="tabicon/yuding-on-1.png">预定</option>
                                                            <option value="tabicon/yuyue-on-1.png">预约</option>
                                                        </select>

                                                    </td>
                                                    <td width="80" align="center">

                                                        @if (i != 0)
                                                        {
                                                            @Html.ActionLink("[删除]", "DeleteTabBar", new { storeappid = Model.StoreAppId, tabindex = i }, new { @class = "editOperate" })
                                                        }

                                                    </td>
                                                </tr>
                                            }
                                            <tr>
                                                <td align="center"></td>
                                                <td align="center"></td>
                                                <td align="center"></td>
                                                <td align="center"></td>
                                                <td align="center">
                                                    @Html.ActionLink("[新增]", "NewTabBar", new { storeappid = Model.StoreAppId }, new { @class = "editOperate" })
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>

                            <tr>
                                <td width="180px" align="right">文字选中颜色：</td>
                                <td>@Html.TextBoxFor(x => x.selectedColor, new { @type = "color" })</td>

                            </tr>
                            <tr>
                                <td width="180px" align="right">导航背景色：</td>
                                <td>@Html.TextBoxFor(x => x.backgroundColor, new { @type = "color" })</td>

                            </tr>



                        </table>
                    </div>

                    <div class="" style="padding-left: 150px;margin-top: 20px">
                        <a href="" class="menuBT sumbitBut button" id="sumbitBut"><img src="/admin_store/images/edit.jpg" />保存</a>
                        &nbsp;&nbsp;

                        @*<a class="menuBT editOperate" href="/storeadmin/weapp/CommitTabBar?storeappid=@Model.StoreAppId" tips="确认发布前已经保存设置，发布会需要微信审核"><img src="/admin_store/images/edit.jpg" />发布</a>*@
                        &nbsp;&nbsp;
                        <a class="menuBT editOperate button" href="/storeadmin/weapp/ResetTabBar?storeappid=@Model.StoreAppId" tips="确认重置为默认设置"><img src="/admin_store/images/refresh.jpg" />重置设置</a>
                    </div>
                    <script type="text/javascript">
                $(function () {
                    $("#color").spectrum({
                        preferredFormat: "name",
                        color: '@Model.color',
                        showInput: true,
                        allowEmpty: false,
                        cancelText: '取消',
                        chooseText: '选取'
                        });
                    $("#selectedColor").spectrum({
                        preferredFormat: "name",
                        color: '@Model.selectedColor',
                        showInput: true,
                        allowEmpty: false,
                        cancelText: '取消',
                        chooseText: '选取'
                    });
                    $("#backgroundColor").spectrum({
                        preferredFormat: "name",
                        color: '@Model.backgroundColor',
                        showInput: true,
                        allowEmpty: false,
                        cancelText: '取消',
                        chooseText: '选取'
                    });
                    $(".tabicon").on("change", function () {
                        var v = $(this).val();
                        var dataindex = $(this).attr("data-index");
                        if (v) {
                            var imagesrc = '@WorkContext.ImageCDN' + '/images/' + v;
                            $("#tabicon" + dataindex).attr("src", imagesrc);
                            $("#list_" + dataindex + "__iconPath").val(v.replace("-on-", "-off-"));
                            $("#list_" + dataindex + "__selectedIconPath").val(v);
                        } else {
                            var rawIconPath = $("#tabicon" + dataindex).attr("rawIconPath");
                            var iconPath = $("#tabicon" + dataindex).attr("iconPath");
                            var selectedIconPath = $("#tabicon" + dataindex).attr("selectedIconPath");
                            $("#tabicon" + dataindex).attr("src", rawIconPath);
                            $("#list_"+dataindex+"__iconPath").val(iconPath);
                            $("#list_" + dataindex + "__selectedIconPath").val(selectedIconPath);
                        }

                    });
                    $("#sumbitBut").click(function () {
                        $("form:first").submit();
                        return false;
                    })
                });
                    </script>


                }
            </td>
            <td style="vertical-align: top; text-align: left;width: 350px">
                <div id="preview-wrap" class="preview-wrap">

                    <div id="phone-component" class="phone-5s">
                        <div class="phone-head">
                            <span id="go-back">返回</span>
                        </div>
                        <div id="phone-container" class="phone-content">
                            <iframe class="preview-iframe" id="preview-iframe" frameborder="0" allowtransparency="true" src="https://appstore.711688.net.cn/#/weapp/preview?storeid=@(WorkContext.StoreId+"&storeappid="+Model.StoreAppId)"></iframe>
                        </div>
                    </div>

                </div>
            </td>
        </tr>
    </table>

}